/**
 * Copyright (c) 2002-2011 旭鸣信息
 * All rights reserved. 
 * File：OrderLogContorller.java
 * History:
 *       Apr 16, 2012: Initially created, liuzhi.
 */
package com.xteam.ecsystem.contorller;

import java.io.IOException;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

import com.tangkf.utils.bean.ReqHelper;
import com.xteam.ecsystem.service.admin.OrderLogService;

/**
 * 订单日志信息控制层
 */
@Controller
public class OrderLogContorller {
	
	@Autowired
	private OrderLogService orderLogService;
	
	public void setToBeJsonType(HttpServletRequest request,
			HttpServletResponse response) {
		response.setContentType("application/json;charset=UTF-8");
	};
	
	@RequestMapping("/getLolListByOrderId.do")
	public void getLolListByOrderId(HttpServletRequest request,
			HttpServletResponse response, ModelMap modelMap) throws IOException {
		setToBeJsonType(request, response);
		
		String boiId = ReqHelper.getRequestString(request, "boiId");		
		String strInfo = this.orderLogService.getLolListByOrderId(boiId);
		
		response.getWriter().write(strInfo);
	}
	
	@RequestMapping("/getOrderLogList.do")
	public void getOrderLogList(HttpServletRequest request,
			HttpServletResponse response, ModelMap modelMap) throws IOException {
		setToBeJsonType(request, response);
		
		int pageIndex = ReqHelper.getRequestInt(request, "pageIndex");
		int pageSize = ReqHelper.getRequestInt(request, "pageSize");
		String boiOsn = ReqHelper.getRequestString(request, "boiOsn");
		String lolUser = ReqHelper.getRequestString(request, "lolUser");
		
		String strList = this.orderLogService.getOrderLogList(boiOsn, lolUser, pageIndex, pageSize);
		response.getWriter().write(strList);
	}

	@RequestMapping("/delOrderLogsByIds.do")
	public void delOrderLogsByIds(HttpServletRequest request,
			HttpServletResponse response, ModelMap modelMap) throws IOException {
		String lolIds = ReqHelper.getRequestString(request, "lolIds");

		this.orderLogService.delOrderLogsByIds(lolIds);
	}
	
	@RequestMapping("/findOrderLogList.do")
	public void findOrderLogList(HttpServletRequest request,
			HttpServletResponse response, ModelMap modelMap) throws IOException {
		String boiId = ReqHelper.getRequestString(request, "boiId");
		int pageIndex = ReqHelper.getRequestInt(request, "pageIndex");
		int pageSize = ReqHelper.getRequestInt(request, "pageSize");
		String str = this.orderLogService.findOrderLogList(pageIndex, pageSize,
				boiId);
		response.getWriter().write(str);
	}
}
